caa53d9d69b3a70ea5408387fea67551acdbae0e,src/main/java/org/HdrHistogram/Recorder.java,Recorder,getIntervalHistogram,#Histogram#,188
Before Change
* @return a histogram containing the value counts accumulated since the last interval histogram was taken.
*/
public synchronized Histogram getIntervalHistogram(Histogram histogramToRecycle) {
if (histogramToRecycle == null) {
if (inactiveHistogram instanceof InternalAtomicHistogram) {
histogramToRecycle = new InternalAtomicHistogram(
instanceId,
inactiveHistogram.getLowestDiscernibleValue(),
inactiveHistogram.getHighestTrackableValue(),
inactiveHistogram.getNumberOfSignificantValueDigits());
} else {
histogramToRecycle = new InternalConcurrentHistogram(
instanceId,
inactiveHistogram.getNumberOfSignificantValueDigits());
}
}
// Verify that replacement histogram can validly be used as an inactive histogram replacement:
validateFitAsReplacementHistogram(histogramToRecycle);
try {
recordingPhaser.readerLock();
inactiveHistogram = histogramToRecycle;
performIntervalSample();
return inactiveHistogram;
} finally {
After Change
*/
public synchronized Histogram getIntervalHistogram(Histogram histogramToRecycle) {
// Verify that replacement histogram can validly be used as an inactive histogram replacement:
validateFitAsReplacementHistogram(histogramToRecycle);
inactiveHistogram = histogramToRecycle;
performIntervalSample();
Histogram sampledHistogram = inactiveHistogram;
inactiveHistogram = null; // Once we expose the sample, we can't reuse it internally until it is recycled